package xyz.suancaiyu.chapter45.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.suancaiyu.chapter45.entity.User;
import xyz.suancaiyu.chapter45.service.UserService;

/**
 * @author puruidong
 * @version 2018/12/28 23:02
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/{username}")
    public User getUser(@PathVariable("username") String username) {
        return userService.findUserByName(username);
    }


}
